#ifndef define_h
#define define_h
#import "OmBaseVC.h"
#import "OmBaseButton.h"
#import "OmHandyMethods.h"
#import "Liu70FPCategory.h"
#import "MJExtension.h"
#import <JCTagListView.h>
#import "UIScrollView+loadData.h"
#import <SDAutoLayout.h>
#import "OmBuyKingHatVC.h"
#import "OmBuyKingHatVC.h"
#define OmDeviceTokenKey @"OmDeviceTokenKey"
#define OmChatWithUserAvatarKey @"OmChatWithUserAvatarKey"
#define OmChatWithUserNickKey @"OmChatWithUserNickKey"
#define SaveObjToUserDefault(obj, key) [[NSUserDefaults standardUserDefaults] setObject:obj forKey:key]
#define LoadObjFromUserDefault(key) [[NSUserDefaults standardUserDefaults] objectForKey:key]
#define BaiduTranslateAPI @"https://fanyi-api.baidu.com/api/trans/vip/translate"
#define BaiduTranslateAPPID @"20181029000227000"
#define BaiduTranslateAPPSECRET @"FABcmmPIkHwWURhTtECS"
#define StatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
#define NavigationBarHeight self.navigationController.navigationBar.frame.size.height
#define TabBarHeight self.tabBarController.tabBar.frame.size.height
#define isCurrentLanguageChinese [[[NSUserDefaults standardUserDefaults] objectForKey:KAppLanguage] containsString:@"zh"]
#define HexadecimalColor(string) [UIColor colorWithHexString:string]
#define PAN_DISTANCE 120
#define CARD_WIDTH RPX(333)
#define CARD_HEIGHT RPX(400)
#define WINDOW_WIDTH [UIScreen mainScreen].bounds.size.width
#define WINDOW_HEIGHT [UIScreen mainScreen].bounds.size.height
#define GetScaleWithDatum(length,datum) (WINDOW_WIDTH * length / datum)
#define RPX(length) GetScaleWithDatum(length,375)
#define RPXFont(height) [UIFont systemFontOfSize:RPX(height)]
#define MediumRPXFont(height) [UIFont systemFontOfSize:RPX(height) weight:UIFontWeightMedium]
#define BoldRPXFont(height) [UIFont  boldSystemFontOfSize:RPX(height)]
#define PerformSelectorMuteWarning(controller, selector) ((void (*)(id, SEL))[controller methodForSelector:selector])(controller, selector)
#define kApplication        [UIApplication sharedApplication]
#define kAppWindow          [UIApplication sharedApplication].delegate.window
#define kAppDelegate        [AppDelegate shareAppDelegate]
#define kRootViewController [UIApplication sharedApplication].delegate.window.rootViewController
#define kUserDefaults       [NSUserDefaults standardUserDefaults]
#define kNotificationCenter [NSNotificationCenter defaultCenter]
#define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
#define kNavBarHeight 44.0
#define kTabBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)
#define kTopHeight (kStatusBarHeight + kNavBarHeight)
#define KScreenWidth ([[UIScreen mainScreen] bounds].size.width)
#define KScreenHeight [[UIScreen mainScreen] bounds].size.height
#define kScreen_Bounds [UIScreen mainScreen].bounds
#define Iphone6ScaleWidth KScreenWidth/375.0
#define Iphone6ScaleHeight KScreenHeight/667.0
#define kRealValue(with) ((with)*(KScreenWidth/375.0f))
#define kScaleX [UIScreen mainScreen].bounds.size.width / 375
#define kScaleY [UIScreen mainScreen].bounds.size.height / 667
#define kWeakSelf(type)  __weak typeof(type) weak##type = type;
#define kStrongSelf(type) __strong typeof(type) type = weak##type;
#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]
#define ViewRadius(View, Radius)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]
#define IOSAVAILABLEVERSION(version) ([[UIDevice currentDevice] availableVersion:version] < 0)
#define CurrentSystemVersion [[UIDevice currentDevice].systemVersion doubleValue]
#define CurrentLanguage (［NSLocale preferredLanguages] objectAtIndex:0])
#ifdef DEBUG
#define DLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define DLog(...)
#endif
#define NSStringFormat(format,...) [NSString stringWithFormat:format,##__VA_ARGS__]
#define KClearColor [UIColor clearColor]
#define KWhiteColor [UIColor whiteColor]
#define KBlackColor [UIColor blackColor]
#define KGrayColor [UIColor grayColor]
#define KGray2Color [UIColor lightGrayColor]
#define KBlueColor [UIColor blueColor]
#define KRedColor [UIColor redColor]
#define kRandomColor    KRGBColor(arc4random_uniform(256)/255.0,arc4random_uniform(256)/255.0,arc4random_uniform(256)/255.0)        
#define BOLDSYSTEMFONT(FONTSIZE)[UIFont boldSystemFontOfSize:FONTSIZE]
#define SYSTEMFONT(FONTSIZE)    [UIFont systemFontOfSize:FONTSIZE]
#define FONT(NAME, FONTSIZE)    [UIFont fontWithName:(NAME) size:(FONTSIZE)]
#define StringFromInteger(i)        [NSString stringWithFormat:@"%@",@(i)]
#define StringFromInt(i)            [NSString stringWithFormat:@"%@",@(i)]
#define ImageWithFile(_pointer) [UIImage imageWithContentsOfFile:([[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@@%dx", _pointer, (int)[UIScreen mainScreen].nativeScale] ofType:@"png"])]
#define IMAGE_NAMED(name) [UIImage imageNamed:name]
#define StrValid(f) (f!=nil && [f isKindOfClass:[NSString class]] && ![f isEqualToString:@""])
#define SafeStr(f) (StrValid(f) ? f:@"")
#define HasString(str,key) ([str rangeOfString:key].location!=NSNotFound)
#define ValidStr(f) StrValid(f)
#define ValidDict(f) (f!=nil && [f isKindOfClass:[NSDictionary class]])
#define ValidArray(f) (f!=nil && [f isKindOfClass:[NSArray class]] && [f count]>0)
#define ValidNum(f) (f!=nil && [f isKindOfClass:[NSNumber class]])
#define ValidClass(f,cls) (f!=nil && [f isKindOfClass:[cls class]])
#define ValidData(f) (f!=nil && [f isKindOfClass:[NSData class]])
#define kStartTime CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
#define kEndTime  NSLog(@"Time: %f", CFAbsoluteTimeGetCurrent() - start)
#define ITTDPRINTMETHODNAME() ITTDPRINT(@"%s", __PRETTY_FUNCTION__)
#define KPostNotification(name,obj) [[NSNotificationCenter defaultCenter] postNotificationName:name object:obj];
#define SINGLETON_FOR_HEADER(className) \
\
+ (className *)shared##className;
#define SINGLETON_FOR_CLASS(className) \
\
+ (className *)shared##className { \
static className *shared##className = nil; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
shared##className = [[self alloc] init]; \
}); \
return shared##className; \
}
#define ASLocalizedString(key)  [NSString stringWithFormat:@"%@", [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"appLanguage"]] ofType:@"lproj"]] localizedStringForKey:(key) value:nil table:@"ASLocalized"]]
#define IsCurrentUserMale [UserManager sharedUserManager].curUserInfo.sex == UserGenderMale
#endif 
